package uk.ac.imperial.gpaexpress.client;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Widget;

public class Notification extends Composite {

	private static final Binder binder = GWT.create(Binder.class);

	interface Binder extends UiBinder<Widget, Notification> {}
	
	@UiField Label dateTimeLabel;
	@UiField Label messageLabel;
	@UiField Anchor dismissAnchor;
	
	
	public Notification(String dateTime, String message) {
		initWidget(binder.createAndBindUi(this));
		dateTimeLabel.setText(dateTime + "---------------------------------------------");
		messageLabel.setText(message);
	}

	@UiHandler("dismissAnchor")
	void logoutClick(ClickEvent e) {	
		this.removeFromParent();
	}
	
}
